package com.gimi.cloud.jimi.dao.dao.bank;

import com.gimi.cloud.jimi.dao.myMapper.MyMapper;
import com.gimi.cloud.jimi.dao.myMapper.core.query.QueryParam;
import com.gimi.cloud.jimi.dao.myMapper.core.query.QueryParamProvider;
import com.gimi.cloud.jimi.dto.bank.BankCardDTO;
import com.gimi.cloud.jimi.entity.bank.BankCard;
import org.apache.ibatis.annotations.*;

/**
 * Created by lixj on 2017/12/18.
 */
@Mapper
public interface BankDao extends MyMapper<BankCard> {

    @SelectProvider(method = "selectCountBySql",type = QueryParamProvider.class)
    String useable(QueryParam param);

    @Select("SELECT * FROM rd_bank_card WHERE user_id = #{userId} limit 1")
    BankCard getBankByUserId(@Param(value = "userId")Integer userId);

    @Select("SELECT * FROM rd_bank_card WHERE card_no = #{cardNo} limit 1")
    BankCard getBankByCardNo(@Param(value = "cardNo")String cardNo);

    @Select("SELECT * FROM rd_bank_card WHERE user_id = #{userId} limit 1")
    BankCardDTO getBankDTOByUserId(@Param(value = "userId")Integer userId);
}
